package tragame.gui;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Insets;

import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

public class JPanel2 extends JPanel{

	private static final long serialVersionUID = 1L;

	public JPanel2 (String layout, String side, int x, int y) {
		
		super();
		
		if ( layout.equals("X") ){
			this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
			if ( side.equals("L") )	this.setAlignmentX(Component.LEFT_ALIGNMENT);
			else if ( side.equals("R") ) this.setAlignmentX(Component.RIGHT_ALIGNMENT);				
			else this.setAlignmentX(Component.CENTER_ALIGNMENT);
		}
		else{
			this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
			if ( side.equals("L") )	this.setAlignmentX(Component.LEFT_ALIGNMENT);
			else if ( side.equals("R") ) this.setAlignmentX(Component.RIGHT_ALIGNMENT);				
			else this.setAlignmentX(Component.CENTER_ALIGNMENT);
		}
			
		
			
		this.setPreferredSize(new Dimension(x, y));
		this.setMaximumSize(new Dimension(x, y));
		this.setMinimumSize(new Dimension(x, y));
		this.setBorder(new EmptyBorder(new Insets(5,5,5,5)));
		this.setOpaque(false);
	}
}
